<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/**
 * @var $this yii\web\View
 * @var $isp app\models\Isp
 */

$this->title = '添加/修改运营商';
$this->params['breadcrumbs'][] = '物联网卡管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<?php $form = ActiveForm::begin();?>
<fieldset>
    <legend>基本参数</legend>
    <?php echo Html::activeHiddenInput($isp, 'id');?>
    <?php echo $form->field($isp, 'name');?>
    <?php echo $form->field($isp, 'api_id')->textInput(['value' => $isp->api->name, 'disabled' => true]);?>
</fieldset>
<fieldset>
    <legend>接口参数</legend>
    <?php echo Html::activeHiddenInput($isp, 'data');?>
    <?php $param = json_decode($isp->api->param, true);
    $data = json_decode($isp->data, true);
    foreach ($param as $p) {?>
        <div class="form-group field-isp-data-<?php echo Html::encode($p);?> required">
            <label class="control-label" for="isp-data-<?php echo Html::encode($p);?>"><?php echo Html::encode($p);?></label>
            <input type="text" id="isp-data-<?php echo Html::encode($p);?>" class="form-control" name="data[<?php echo Html::encode($p);?>]" value="<?php echo Html::encode(isset($data[$p]) ? $data[$p] : '');?>" aria-required="true">
            <div class="help-block"></div>
        </div>
    <?php }?>
</fieldset>
<div class="form-group">
    <div class="col-lg-offset-1 col-lg-11">
        <button type="button" class="btn btn-default" onclick="window.history.go(-1);"><i class="ace-icon fa fa-arrow-left bigger-110"></i>返回</button>
        <button class="btn btn-primary"><i class="ace-icon fa fa-check bigger-110"></i>保存</button>
        <button type="reset" class="btn btn-warning"><i class="ace-icon fa fa-undo bigger-110"></i>重置</button>
    </div>
</div>
<?php $form->end();?>
